package com.fdd.op.sdk.request.api.otherverify;

import com.fdd.op.sdk.ApiRuleException;
import com.fdd.op.sdk.BaseFddRequest;
import com.fdd.op.sdk.FddUploadRequest;
import com.fdd.op.sdk.FileItem;
import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.mapping.RequestField;
import com.fdd.op.sdk.response.api.otherverify.OtherVerifyResourceResponse;

import java.util.HashMap;
import java.util.Map;

public class OtherVerifyResourceRequest extends BaseFddRequest<OtherVerifyResourceResponse> implements FddUploadRequest<OtherVerifyResourceResponse> {
    @Override
    public String getApiMethodName() {
        return "/user/api/otherVerify/otherVerifyResource";
    }

    @Override
    public Map<String, Object> getTextParams() {
        return null;
    }

    @Override
    public Class<OtherVerifyResourceResponse> getResponseClass() {
        return OtherVerifyResourceResponse.class;
    }


    @Override
    public void check() throws ApiRuleException {

    }

    @Override
    public String getHttpMethod() {
        return Constants.METHOD_POST;
    }

    @RequestField("fileName")
    private String fileName;

    @RequestField("docUrl")
    private String docUrl;

    private Map<String, FileItem> fileItemMap;

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getDocUrl() {
        return docUrl;
    }

    public void setDocUrl(String docUrl) {
        this.docUrl = docUrl;
    }

    @Override
    public Map<String, FileItem> getFileParams() {
        return fileItemMap;
    }

    @Override
    public void setFileItem(String key, FileItem fileItem) {
        if(fileItemMap == null){
            fileItemMap = new HashMap<>();
        }
        fileItemMap.put("file", fileItem);
    }
}
